<template>
	<view>
		<view class="download-wrapper">
			<view class="download-btn font28" @click="downloadCode">前往git下载源码</view>
		</view>
	</view>
</template>
	
<script>
	const gitUrl = "http://gitlab.cndatacom.com/cdc-product-base/pub_pa_mix/-/tree/feature/components/";
	export default {
		// 组件的git仓库地址
		props: {
			//详细路径
			dwnSrc: {		
				type: String,
				default: ''
			}
		},
		methods:{
			downloadCode(){
				//限制用户只能在浏览器端打开
				//#ifndef H5
					uni.showModal({
					    title: '提示',
					    content: '请用浏览器打开！',
						showCancel:false,
					    success: function (res) {
					        if (res.confirm) {
					            console.log('用户点击确定');
					        }
					    }
					});
					return false;
				//#endif
				let url = gitUrl + this.dwnSrc;
				window.open(url);
			}
		}
	}
</script>

<style lang="scss">
	.download-wrapper {
		display: flex;
		flex-flow: row nowrap;
		justify-content: flex-end;
	}

	.download-btn {
		padding: 10rpx 20rpx;
		color: #ffffff;
		background-color: $jk-color-primary;
		width: 250rpx;
		border-radius: 8rpx;
		text-align: center;
		margin-right: 20rpx;
	}
</style>
